﻿using AutoMapper;
using Nop.Plugin.Misc.MessageDesigner.Domain;
using Nop.Plugin.Misc.MessageDesigner.Models;


namespace Nop.Plugin.Misc.MessageDesigner
{
    public static class MappingExtensions
    {
        public static TDestination MapTo<TSource, TDestination>(this TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }

        public static TDestination MapTo<TSource, TDestination>(this TSource source, TDestination destination)
        {
            return Mapper.Map(source, destination);
        }

        #region  Messaeg 

        public static MessageDesignModel ToModel(this MessageDesign entity)
        {
            return entity.MapTo<MessageDesign, MessageDesignModel>();
        }

        public static MessageDesign ToEntity(this MessageDesignModel model)
        {
            return model.MapTo<MessageDesignModel, MessageDesign>();
        }

        public static MessageDesign ToEntity(this MessageDesignModel model, MessageDesign destination)
        {
            return model.MapTo(destination);
        }
        #endregion

    }
}